index.html.vue 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  1. <template>
  2. <!-- 页面头部 -->
  3. <HomePageHead></HomePageHead>
  4. <!-- 导航栏 -->
  5. <HomePageNavigation1></HomePageNavigation1>
  6. <!-- 列表页广告一 -->
  7. <HomeTopTen :imgurl="adImg1" v-if="adImg1"></HomeTopTen>
  8. <!-- 面包屑导航 -->
  9. <div class="breadcrumb breadcrumb_phone_none">
  10. <div class="inner">
  11. <span class="location">当前位置:</span>
  12. <el-breadcrumb :separator-icon="ArrowRight">
  13. <el-breadcrumb-item>
  14. <NuxtLink to="/">首页</NuxtLink>
  15. </el-breadcrumb-item>
  16. <el-breadcrumb-item>
  17. {{ newsDetail.con_title ? newsDetail.con_title : bottomMenu[num]?.name }}
  18. </el-breadcrumb-item>
  19. </el-breadcrumb>
  20. </div>
  21. </div>
  22. <div class="breadcrumb_box breadcrumb_pc_none">
  23. <span class=" ">当前位置:</span>
  24. <NuxtLink to="/">首页</NuxtLink>
  25. <span class=" ">&gt;</span>
  26. <span class=" ">
  27. {{ newsDetail.con_title ? newsDetail.con_title : bottomMenu[num]?.name }}
  28. </span>
  29. </div>
  30. <!-- 资讯列表 -->
  31. <div class="newsDetail">
  32. <div class="inner">
  33. <div class="innerDetail">
  34. <div class="headImg"></div>
  35. <div class="innerDetail1">
  36. <div class="leftBottom" v-html="newsDetail.content"></div>
  37. </div>
  38. <div class="footImg"></div>
  39. </div>
  40. <div class="innerLeft phone_none">
  41. <ul>
  42. <li>
  43. 导航列表
  44. </li>
  45. <li v-for="(item, index) in bottomMenu" :key="index">
  46. <NuxtLink v-if="item.type == 0" :to="`/about/${item.name_pinyin}/index.html`" :title="item.name"
  47. :class="item.id == pageId ? 'active' : ''">
  48. {{ item.name }}
  49. </NuxtLink>
  50. <NuxtLink v-else-if="item.type == 1" :to="`/about/${item.name_pinyin}/list-1.html`"
  51. :title="item.name" :class="item.id == pageId ? 'active' : ''">
  52. {{ item.name }}
  53. </NuxtLink>
  54. </li>
  55. </ul>
  56. </div>
  57. <div style="clear: both;"></div>
  58. </div>
  59. </div>
  60. <!-- 广告二 -->
  61. <HomeTopTen :imgurl="adImg2" v-if="adImg2"></HomeTopTen>
  62. <!-- 页面底部 -->
  63. <HomeFoot1></HomeFoot1>
  64. </template>
  65. <script setup>
  66. //1.页面依赖 start ---------------------------------------->
  67. import { ElBreadcrumb, ElBreadcrumbItem } from 'element-plus'
  68. import { ArrowRight } from '@element-plus/icons-vue'
  69. import { ref, onMounted } from 'vue';
  70. //获得跳转过来的id
  71. const route = useRoute();
  72. //获得当前的完整路径
  73. const fullPath = route.path;
  74. //拆分,取出来中间这一段,然后提取数字部分
  75. const segments = fullPath.split('/');
  76. const targetSegment = segments[2];
  77. //const numberPart = targetSegment.match(/\d+$/)?.[0];
  78. let num = ref(0);
  79. let articleId;
  80. let pageId;
  81. //通过导航路径反向查询导航id
  82. const getRouteId = await requestDataPromise('/web/getWebsiteRoute', {
  83. method: 'GET',
  84. query: {
  85. 'foot_pinyin': targetSegment,
  86. },
  87. });
  88. if (getRouteId.code == 200) {
  89. articleId = getRouteId.data.id;
  90. pageId = getRouteId.data.id;
  91. } else {
  92. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  93. console.log("错误位置:通过url路径查询导航池id")
  94. console.log("后端错误反馈:", getRouteId.message)
  95. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  96. }
  97. //1.页面依赖 end ---------------------------------------->
  98. //2.页面数据 start ---------------------------------------->
  99. //广告列表
  100. const adList = ref([]);
  101. let adImg1 = ref([]);
  102. let adImg2 = ref([]);
  103. async function getAdData() {
  104. const adData = await requestDataPromise('/web/getWebsiteAdvertisement', { method: 'GET', query: { 'ad_tag': 'PAGE' } });
  105. adList.value = adData.data;
  106. if (adData.code == 200) {
  107. for (let item of adData.data) {
  108. if (item.ad_tag == 'PAGE_0001') {
  109. adImg1.value = item;
  110. }
  111. if (item.ad_tag == 'PAGE_0002') {
  112. adImg2.value = item;
  113. }
  114. }
  115. } else {
  116. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  117. console.log("错误位置:获取详情页广告列表")
  118. console.log("后端错误反馈:", adData.message)
  119. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  120. }
  121. }
  122. getAdData();
  123. const newsDetail = ref({})
  124. const bottomMenu = ref([]);
  125. async function getPageData() {
  126. const mkdata = await requestDataPromise('/web/getWebsiteFooterCategoryInfo', {
  127. method: 'GET',
  128. query: {
  129. 'fcat_id': articleId,
  130. 'type': 0,
  131. },
  132. });
  133. if (mkdata.code == 200) {
  134. newsDetail.value = mkdata.data;
  135. }
  136. }
  137. getPageData();
  138. async function getPageMenu() {
  139. const mkdata = await requestDataPromise('/web/getWebsiteFooterCategory', {
  140. method: 'GET',
  141. query: {},
  142. });
  143. if (mkdata.code == 200) {
  144. bottomMenu.value = mkdata.data;
  145. mkdata.data.forEach((item, index) => {
  146. if (item.id == articleId) {
  147. num.value = index;
  148. }
  149. });
  150. }
  151. }
  152. getPageMenu();
  153. //2.页面数据 end ---------------------------------------->
  154. //4.设置seo信息 start---------------------------------------->
  155. //4.1 设置seo信息
  156. const setData = await requestDataPromise('/web/getWebsiteFootInfo', {
  157. method: 'GET',
  158. query: {},
  159. });
  160. let seoTitle = setData.data.website_head.title;
  161. let seoDescription = setData.data.website_head.description;
  162. let seoKeywords = setData.data.website_head.keywords;
  163. let seoSuffix = setData.data.website_head.suffix;
  164. let seoName = setData.data.website_head.website_name;
  165. useSeoMeta({
  166. title: seoTitle + "_" + seoSuffix,
  167. meta: [
  168. { name: 'description', content: seoDescription + "_" + seoName + "_" + seoSuffix, tagPriority: 10 },
  169. { name: 'keywords', content: seoKeywords + "_" + seoName + "_" + seoSuffix, tagPriority: 10 },
  170. { name: 'viewport', content: 'width=device-width,initial-scale=1,user-scalable=no',tagPriority: 10 }
  171. ]
  172. });
  173. //4.设置seo信息 end---------------------------------------->
  174. onMounted(async () => {
  175. //从客户端获取行政职能部门 加快打开速度
  176. const { $webUrl, $CwebUrl } = useNuxtApp();
  177. //广告1
  178. let url = `${$webUrl}/web/getWebsiteAdvertisement?ad_tag=nzgxw_page_0001`
  179. const responseAd1 = await fetch(url, {
  180. headers: {
  181. 'Content-Type': 'application/json',
  182. 'Userurl': $CwebUrl,
  183. 'Origin': $CwebUrl
  184. }
  185. });
  186. const resultAd1 = await responseAd1.json();
  187. adImg1.value = resultAd1.data[0];
  188. //广告2
  189. let url2 = `${$webUrl}/web/getWebsiteAdvertisement?ad_tag=nzgxw_page_0002`
  190. const responseAd2 = await fetch(url2, {
  191. headers: {
  192. 'Content-Type': 'application/json',
  193. 'Userurl': $CwebUrl,
  194. 'Origin': $CwebUrl
  195. }
  196. });
  197. const resultAd2 = await responseAd2.json();
  198. adImg2.value = resultAd2.data[0];
  199. })
  200. </script>
  201. <style lang="less" scoped>
  202. @import '@/assets/css/about.less';
  203. </style>
  204. <style lang="less" scoped>
  205. @media screen and (min-width:801px){/*pc*/
  206. .breadcrumb_pc_none{display:none!important;}
  207. .pc_none{display:none;}
  208. }
  209. @media screen and (max-width:800px){/*ipad_phone*/
  210. .breadcrumb_box{
  211. height:22px;width:100%;margin:16px auto 9px;
  212. word-break: keep-all; white-space: nowrap;overflow:hidden;text-overflow:ellipsis;
  213. width:92%;
  214. font-size:14px;
  215. color:#666;
  216. *{
  217. font-size:14px;
  218. display:inline ;
  219. color:#666;
  220. line-height:22px;height:22px;
  221. margin-right:5px;
  222. }
  223. }
  224. .newsDetail{min-height:auto;}
  225. .newsDetail .inner{width:92%!important;}
  226. .newsDetail .inner .innerDetail{width:100%;margin-bottom:8px;}
  227. .newsDetail .inner .innerDetail .innerDetail1{width:100%;padding:10px;}
  228. .newsDetail .inner .innerDetail .headImg{display:none;}
  229. .newsDetail .inner .innerDetail .footImg{display:none;}
  230. .newsDetail .inner .innerDetail .innerDetail1{background:rgba(0,0,0,0);border:1px solid #ffeef1;}
  231. .newsDetail .inner .innerDetail .leftBottom *{
  232. font-size: 16px!important;;
  233. line-height: 22px;
  234. }
  235. .breadcrumb_phone_none{display:none!important;}
  236. // .innerLeft{display:none;}
  237. .phone_none{display:none;}
  238. }
  239. </style>